using nTools.SqlTools;
using nTools.SqlTools.Core;
using nTools.SqlTools.Drivers;
using SqlUtils = nTools.SqlTools.Utilities;
...
string _host;
string _database;
string _userName;
string _password;
...
SqlManager.Load(new MySql());
SqlManager.Connect(_host, _userName, _password, _database);
/**
* Query Database using Chain method:
*
* SELECT `name`,`title`, b.id AS `col3`
* FROM `table1`, `table2` AS `b`
* WHERE table1.id = table2.id
* ORDER BY `name`
* DESC
* LIMIT 10;
*
**/
SqlManager
.Select
(
"name",
"title",
SqlUtils.As("b.id", "col3")
)
.From
(
"table1",
SqlUtils.Alias("table2", "b")
)
.Where
(
SqlUtils.Equals("table1.id", "table2.id")
)
.Go
(
SqlUtils.OrderBy("name"),
SqlUtils.Desc(),
SqlUtils.Limit(10)
);
...